home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / x1.zip / README.TXT < prev    next >
Text File  |  1993-05-19  |  5KB  |  117 lines

  1.             Wolf-3D Generic engine
  2.             ----------------------
  3.  
  4.  
  5.     HELP! I have been working on the generic wolf-3D style engine and am
  6. having difficulty getting some problems ironed out. If anyone would be
  7. willing to look over the source and see if they can determine where the
  8. errors are I would greatly appreciate it.
  9.  
  10.     Run XTEST.EXE to see the current results of the engine (XTEST.C)
  11.  
  12.     Currently there are two routines to draw the view on the screen. The
  13.     latest one is invoked by default. To use the older version type
  14.  
  15.              XTEST -O
  16.  
  17.     on the command line. Both routines suffer from the same
  18.     problems however....
  19.  
  20.     Keyboard control is all I have in there so far and I borrowed the
  21. routines in a hurry from Michael Mstowski's SCPY program. They work good
  22. and my thanks to Michael if he's listening.
  23.  
  24.     XTEST also temporarily uses the VGA240 library that was found in the
  25. Game Design forum to draw the horizontal and vertical lines in mode X.
  26.  
  27. ==============================================================================
  28. Keyboard control:
  29.  
  30.     Esc        - Exits program
  31.     Right   - Turns right 4 degrees
  32. Ctrl Right  - Turns right 45 degrees
  33.     Left    - Turns left 4 degrees
  34. Ctrl Left   - Turns left 45 degrees
  35.     Up        - Moves forward 2 units
  36.     Home    - Moves forward 128 units
  37.     PgUp    - Moves forward 20 units
  38.     End        - Moves backwards 128 units
  39.     PgDn    - Moves backwards 20 units
  40.  
  41.  
  42. ==============================================================================
  43. Files and what they are for:
  44.  
  45. xtest.c        - Code I am trying to get working
  46. xtest.exe   - Compiled and ready to run
  47. f.dat        - Table of angle offsets used during the scanning process
  48.  
  49. ==============================================================================
  50. Current problems with xtest code:
  51.  
  52. 1. Spikes or divits in the walls at certain distances and angles. This is the
  53.    main one I've been trying to concentrate on but so far no luck. My thought
  54.    is that there is a round-off error when using the cosine table to adjust
  55.    the actual distance from the wall to the current X,Y position.
  56.  
  57.  
  58.              D2
  59.               P-------W <--- Hit on a wall
  60.               |        / <----- Angle currently scanning for a wall
  61.               | D1/
  62.               | /
  63.               @ -----------> Current view angle
  64.               |
  65.               |
  66.               | <----------- Perpendicular angle to view angle
  67.               |
  68.  
  69.           Figure 1
  70.  
  71.     From the figure lets say the current angle we are facing is to the right
  72. (or angle 0). The scanning routine starts 45 degrees to the left of the current
  73. angle for the first pixel column of the display. We cast a ray out (either x
  74. or y) and finds a wall (W). Distance D1 can be calculated from the square root
  75. of the deltaX squared and deltaY squared values. But D1 will always be from the
  76. specific point where we are standing. What seems to be needed is an adjusted
  77. distance that is always perpendicular to the current angle we are facing. So
  78. by taking the cosine of the scanning angle and multiplying that by D1 we get
  79. the adjusted distance D2. (Hopefully this is the right way to go....) This will
  80. give us the distance from the wall to point P which should remain fairly
  81. constant for flat walls when we face them directly.
  82.  
  83. It is here where the spikes/divits appear. If the distance adjustment is not
  84. made then the flat walls we are facing appear curved as we move further away
  85. from the angle we are facing (the fishbowl or fisheye effect mention in previous
  86. threads). But the spikes disappear!
  87.  
  88.  
  89.  
  90.  
  91. 2. The other immediate problem is that some corners of walls are missed during
  92.    the scanning process as if the current angle being scanned doesn't strike
  93.    the correct wall in either the X or Y direction. Debugging has shown this
  94.    to be the case where the X coordinate is right on a 64 boundary but the
  95.    Y coordinate just misses the wall (this is during an X scan). I haven't
  96.    looked into this one as much yet, but I suspect it is again related to
  97.    a round-off error when using the tangent table.
  98.  
  99.  
  100.  
  101. If anyone can see what's wrong here or can offer any suggestions it would be
  102. greatly appreciated. Once I get past these hurdles my goal is to create a
  103. generic library function that can be included in any program. I am also
  104. planning on uploading the completed engine source code for public use since
  105. it is such a popular engine and I think we could all see some fantastic
  106. games/applications built around it.....
  107.  
  108. I would be willing to collaborate with anyone who is interested in pursuing
  109. this "adventure" to a logical conclusion. I can code but I can't draw so any
  110. graphic artist who want to join in please let me know.....
  111.  
  112. Thanks in advance
  113.  
  114. Lary Myers
  115. 76004,1574
  116.  
  117.